From d2b6118c50eb50e6b2cf1cb8d55e8f6941f050e4 Mon Sep 17 00:00:00 2001 From: Stevan Earl Date: Sat, 12 Sep 2026 17:44:22 -0700 Subject: [PATCH] feat(events): allow B-record notes to use sdb_no_time --- db/schemas/sokwedb/tables/create/events.m4 | 6 +++--- doc/src/tables/events.m4 | 23 +++++++++++++++------- include/limits.m4 | 4 ++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/db/schemas/sokwedb/tables/create/events.m4 b/db/schemas/sokwedb/tables/create/events.m4 index 115eeb1..07415c5 100644 --- a/db/schemas/sokwedb/tables/create/events.m4 +++ b/db/schemas/sokwedb/tables/create/events.m4 @@ -82,7 +82,7 @@ CREATE TABLE events ( noseconds_check(`Start') CONSTRAINT "Start cannot be before sdb_min_event_start" CHECK (start >= 'sdb_min_event_start' - OR (behavior = 'sdb_aggression' + OR (behavior IN ('sdb_aggression', 'sdb_brec_note') AND start = 'sdb_no_time')) ,stop TIME NOT NULL noseconds_check(`Stop') @@ -96,9 +96,9 @@ CREATE TABLE events ( CONSTRAINT "Start cannot be after Stop" CHECK (start <= stop) - CONSTRAINT "Stop cannot be sdb_no_time unless Behavior is sdb_aggression" + CONSTRAINT "Stop cannot be sdb_no_time unless Behavior allows no time" CHECK (stop <> 'sdb_no_time' - OR behavior = 'sdb_aggression') + OR behavior IN ('sdb_aggression', 'sdb_brec_note')) CONSTRAINT "Start and Stop must either both be sdb_no_time or neither can be" CHECK ((start = 'sdb_no_time' AND stop = 'sdb_no_time') diff --git a/doc/src/tables/events.m4 b/doc/src/tables/events.m4 index 6c3139d..19c6502 100644 --- a/doc/src/tables/events.m4 +++ b/doc/src/tables/events.m4 @@ -313,6 +313,11 @@ The following table lists these rules and implications: This means the value of the EVENTS.\ |EVENTS.Start| column must equal the value of the EVENTS.\ |EVENTS.Stop| column. + B-Record notes are allowed to have no record of the time they were + taken, in which case the special value of ``sdb_no_time`` is used. + This value represents no recorded time, not a note taken at midnight. + See below for more detail. + For B-Record note taking events, the EVENTS.\ |EVENTS.Certainty| column must be ``sdb_identity_certain``. @@ -710,19 +715,23 @@ The following table lists these rules and implications: must be ``sdb_identity_certain``. -Aggressions may have no record of what time the aggression occurred. -In this case the special value of ``sdb_no_time``, midnight, is -recorded in the database.\ [#f2]_ +Aggressions and B-Record notes may have no record of the time they +occurred or were taken. +In this case the special value of ``sdb_no_time``, represented in the +database as midnight, is recorded.\ [#f2]_ +This value means no time was recorded; it does not mean the event +occurred at midnight. The following rules reflect this. The value of |EVENTS.Start| cannot be before ``sdb_min_event_start``. -The exception is that when the |EVENTS.Behavior| value is -``sdb_aggression``, an aggression, |EVENTS.Start| may have the +The exception is that when the |EVENTS.Behavior| value is either +``sdb_aggression`` or ``sdb_brec_note``, |EVENTS.Start| may have the "special value" of ``sdb_no_time``. This value indicates that no start time was recorded. -When the |EVENTS.Behavior| value is ``sdb_aggression``, an aggression, -|EVENTS.Stop| may have the "special value" of ``sdb_no_time``. +When the |EVENTS.Behavior| value is either ``sdb_aggression`` or +``sdb_brec_note``, |EVENTS.Stop| may have the "special value" of +``sdb_no_time``. This value indicates that no stop time was recorded. When no start time was recorded then no stop time may be recorded diff --git a/include/limits.m4 b/include/limits.m4 index 6a1ea96..ac17510 100644 --- a/include/limits.m4 +++ b/include/limits.m4 @@ -73,8 +73,8 @@ dnl The latest possible time an event can occur in a follow. dnl (In 24 hour time) define(`sdb_max_event_stop', `20:00') -dnl The "special value" that aggressions are allowed to have -dnl that means that no time was recorded. +dnl The "special value" that aggressions and B-Record notes are allowed +dnl to have that means that no time was recorded. define(`sdb_no_time', `00:00') dnl The earliest possible BIOGRAPHY_LOG.DateOfUpdate -- 2.34.1